import Vue from "vue";
import App from "./App.vue";
import ElementUI from "element-ui";
import vueRouter from "vue-router";
import Vuex from "vuex";
import store from "./vuex/store";
import login from "./module/login/index";

import "./element-variables.scss";
import "element-ui/lib/theme-chalk/index.css";
import "../public/style/iconfont/iconfont.css";
import "jquery";
import "../public/js/ht/ht.js";
import "../public/js/ht/ht-form.js";
import "../public/js/ht/ht-htmlnode.js";
import "../public/js/ht/ht-edgetype.js";
import "../public/js/ht/ht-autolayout.js";
import "../public/js/ht/ht-contextmenu.js";

// import '../public/js/yyy/twemoji.min.js';
// import '../public/js/yyy/d3.min.js';
// import '../public/js/yyy/neo4jd3.js';

const routes = [
  // {path:'/', redirect: '/login'},
  { path: "/", redirect: "/model_manage" },
  // {path: '/login', component: login},
  {
    path: "/",
    component: (resolve) => require(["./module/home"], resolve),
    children: [
      {
        // path: 'model_manage', component: (resolve) => require(['./module/model_manage/index'], resolve), children: [
        path: "model_manage",
        component: (resolve) =>
          require(["./module/model_manage/model_manage/index"], resolve),
        children: [
          { path: "/", redirect: "model_manage" },
          {
            path: "model_manage",
            component: (resolve) =>
              require(["./module/model_manage/model_manage/index"], resolve),
          },
        ],
      },
      {
        path: "instance_manage",
        component: (resolve) =>
          require(["./module/instance_manage/index"], resolve),
        children: [
          { path: "/", redirect: "entities" },
          {
            path: "entities",
            component: (resolve) =>
              require(["./module/instance_manage/entities/index"], resolve),
          },
          {
            path: "relationships",
            component: (resolve) =>
              require([
                "./module/instance_manage/relationships/index",
              ], resolve),
          },
        ],
      },
      {
        path: "knowledge",
        component: (resolve) => require(["./module/knowledge/index"], resolve),
        children: [
          { path: "/", redirect: "entities" },
          {
            path: "entities",
            component: (resolve) =>
              require(["./module/knowledge/entities/index"], resolve),
          },
          {
            path: "relationships",
            component: (resolve) =>
              require(["./module/knowledge/relationships/index"], resolve),
          },
          {
            path: "properties",
            component: (resolve) =>
              require(["./module/knowledge/properties/index"], resolve),
          },
          {
            path: "subnet",
            component: (resolve) =>
              require(["./module/knowledge/subnet/index"], resolve),
          },
          {
            path: "aggregate",
            component: (resolve) =>
              require(["./module/knowledge/aggregate/index"], resolve),
          },
        ],
      },
      {
        path: "connect",
        component: (resolve) => require(["./module/connect/index"], resolve),
        children: [
          { path: "/", redirect: "database" },
          {
            path: "database",
            component: (resolve) =>
              require(["./module/connect/database/index"], resolve),
          },
          {
            path: "images",
            component: (resolve) =>
              require(["./module/connect/image/index"], resolve),
            meta: { keepAlive: false },
          },
          {
            path: "imageDetail",
            component: (resolve) =>
              require(["./module/connect/image/detail/index"], resolve),
            meta: { keepAlive: false },
          },
        ],
      },
      {
        path: "model",
        component: (resolve) => require(["./module/model/index"], resolve),
        children: [
          { path: "/", redirect: "alias" },
          {
            path: "model_manage",
            component: (resolve) =>
              require(["./module/model_manage/model_manage/index"], resolve),
          },
          {
            path: "knowledge",
            component: (resolve) =>
              require(["./module/model/knowledge/index"], resolve),
          },
          {
            path: "alias",
            component: (resolve) =>
              require(["./module/model/alias/index"], resolve),
          },
          {
            path: "source",
            component: (resolve) =>
              require(["./module/model/source/index"], resolve),
          },
          {
            path: "transition",
            component: (resolve) =>
              require(["./module/model/transition/index"], resolve),
          },
          {
            path: "regular_model",
            component: (resolve) =>
              require(["./module/model/regular_model/index"], resolve),
          },
          {
            path: "grammar_model",
            component: (resolve) =>
              require(["./module/model/grammar_model/index"], resolve),
          },
          {
            path: "training_model",
            component: (resolve) =>
              require(["./module/model/training_model/index"], resolve),
          },
          {
            path: "log",
            component: (resolve) =>
              require(["./module/model/log/index"], resolve),
          },
        ],
      },
    ],
  },
];

const router = new vueRouter({
  // mode: 'history',
  routes,
});
//切换路由检查，如果没有token，直接跳到登录界面.
// router.beforeEach((to, from, next) => {
//     if (!sessionStorage.token && to.path !== '/login') {
//         next({path: '/login'});
//     }
//     next();
// });

Vue.use(ElementUI);
Vue.use(vueRouter);
// Vue.use(ElementUI, {size: 'medium', zIndex: 3000});
Vue.use(Vuex);

// Vue.use(neo4jd3);
// var Neo4jD3 = require('neo4jd3');
// import neo4jd3 from 'neo4jd3'

Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App),
  router,
  store,
}).$mount("#app");

// module.exports = Neo4jD3;
